using System.Drawing;
using Tiwo.Design.Renderers;
using Tiwo.Design.Trackers;

namespace Tiwo.Design.ItemRenderers
{
    public class MoveRectangularModificator : IRendererModification
    {
        public RectangularRenderer Renderer { get; set; }

        public MoveRectangularModificator(RectangularRenderer renderer)
        {
            Renderer = renderer;
        }

        public virtual IMouseTracker CreateMouseTracker(PointF location)
        {
            if (IsReadyToDrag(location))
                return new DragRendererMouseTracker(Renderer);
            return null;
        }

        private bool IsReadyToDrag(PointF location)
        {
            return new RectangleF(Renderer.Location, Renderer.Size).Contains(location);
        }
    }
}